How to debug problems in Linux kernel module `init()`?
Posted
by Kimvais
on Stack Overflow
See other posts from Stack Overflow
or by Kimvais
Published on 2010-04-09T10:41:05Z
Indexed on
2010/04/09
10:43 UTC
Read the original article
Hit count: 266
I am using remote (k)gdb to debug a problem in a module that causes a panic when loaded e.g. when init()
is called.
The stack trace just shows that do_one_initcall(mod->init)
causes the crash. In order to get the symbol file loaded in the gdb, I need to get the address of the module text section, and to get that I need to get the module loaded.
Because the insmod
in busybox (1.16.1) doesn't support -m
so I'm stuck to grep modulename /proc/modules
+ adding the offset from nm
to figure out the address.
So I'm facing a sort a of a chicken and an egg problem here - to be able to debug the module loading, I need to get the module loaded - but in order to get the module loaded, I need to debug the problem...
So I am currently thinking about two options - is there a way to get the address information either:
- by printk() in the module init code
- by printk() somewhere in the kernel code
all this prior to calling the mod->init()
- so I could place a breakpoint there, load the symbol file, hit c and see it crash and burn...
© Stack Overflow or respective owner